package models

import (
	"gorm.io/driver/mysql"
	"gorm.io/gorm"
	"log"
)

var DB *gorm.DB

func Init() {
	dsn := "root:3677bf6e037857724920065d38fc4c70@tcp(14.103.156.93:3306)/lx"
	var err error
	DB, err = gorm.Open(mysql.Open(dsn))
	if err != nil {
		panic(err)
	} else {
		log.Println("连接成功")
	}
	DB.AutoMigrate(&Order{})
}
